package com.nineclock.system.controller;

import com.nineclock.common.entity.Result;
import com.nineclock.system.service.SmsService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("sms")
public class SmsController {

    @Autowired(required = false)
    private SmsService smsService;

    /**
     * 短信: 发送短信验证码
     * 接口路径：GET/sys/sms/code
     */
    @GetMapping("code")
    public Result sendSms(String mobile,String type){
        smsService.sendSms(mobile,type);
        return Result.success();
    }

    /**
     * 接口名称：短信: 验证码校验
     * 接口路径：GET/sys/sms/verify
     */
    @ApiOperation(value = "短信: 验证码校验")
    @GetMapping("verify")
    public Result<Boolean> verifySmsCode(String checkcode,String mobile,String type){
        return Result.success(smsService.verifySmsCode(mobile,checkcode,type));
    }
}
